<template>
  <a-radio-group v-model="current">
    <a-radio
      v-for="item in array"
      :style="radioStyle"
      :value="item.value"
      :label="item.label"
      :key="item.value"
      >{{ item.label }}</a-radio
    >
  </a-radio-group>
</template>

<script lang="ts">
import { Mixins, Component, Watch, Vue, Prop } from 'vue-property-decorator'
import { PayUnitType, PayUnitTypeEnum, reviewDict } from '@/common/enum'

@Component({
  components: {
  },
})
export default class UpdateSubsidy extends Vue {
  @Prop({
    type: String
  })
  public currentPayUnitId!: string
  @Prop({
    type: String
  })
  public type!: string

  @Watch('currentPayUnitId', { immediate: true })
  public handlerChangePayunitId() {
    this.current = this.currentPayUnitId
  }

  public radioStyle = {
    display: 'block',
    height: '30px',
    lineHeight: '30px',
  }

  public current = ''

  public array = PayUnitType.filter(
    (item) => this.type === 'unit_base' ? item.value !== PayUnitTypeEnum.FIELD : true
  )
    .map((item) => {
      let label = item.label

      switch (item.value) {
        case '1':
          label = item.label + '(粮食种植面积)'
          break
        case '2':
          label = item.label + '(实际耕种面积)'
          break
        case '3':
          label = item.label + '(二轮承包面积)'
          break
        case '4':
          label = item.label + '(计税耕地面积)'
          break
        case '5':
          label = item.label + '(确权耕地面积)'
          break
      }

      return {
        label,
        value: item.value,
      }
    })
    .concat(this.type === 'unit_base' ? [
      {
        label: '空白(待定)',
        value: '',
      },
    ] : [])
}
</script>

<style scoped lang="less"></style>
